// api
import { country, createdBy, interviewer } from "@/api/index"
export function useSelectAsync() {
  const useGetCountryOptions = (keyword: string = "", size: number = 50) => {
    return new Promise((resolve, reject) => {
      country({ keys: keyword, size })
        .then((res: any) => {
          resolve(res)
        })
        .catch(() => {
          reject()
        })
    })
  }
  const useGetCreatedByOptions = (keyword: string = "", size: number = 50) => {
    return new Promise((resolve, reject) => {
      createdBy({ keys: keyword, size })
        .then((res: any) => {
          resolve(res)
        })
        .catch(() => {
          reject()
        })
    })
  }
  const useGetInterviewOptions = (keyword: string = "", size: number = 50) => {
    return new Promise((resolve, reject) => {
      interviewer({ keys: keyword, size })
        .then((res: any) => {
          resolve(res)
        })
        .catch(() => {
          reject()
        })
    })
  }
  return {
    useGetCountryOptions,
    useGetCreatedByOptions,
    useGetInterviewOptions,
  }
}
